<template>
	<div style="position: relative;">
		
		
		
		<div v-if="percent == 0?false:true" style="width: 100%;height: 100%;background-color: rgba(255,255,255,0.8);z-index:999;position: absolute;left: 0%;top: 20px;">
			<i-circle :percent="percent" :stroke-color="color" style="position: absolute;top: 50%;margin-left: -60px;margin-top: -60px;">
		        <Icon v-if="percent == 100" type="ios-checkmark-empty" size="60" style="color:#5cb85c"></Icon>
		        <span v-else style="font-size:24px">{{ percent }}%</span>
		    </i-circle>
		</div>
		
		<div style="width: 100%;height: 20px;background-color: #ebedf0;"></div>
		
		<div class="introductioncalculation">
			<!--<div style="width: 100%;height: 20px;background-color: #ebedf0;"></div>-->
			<Row style="text-align: left;margin-top: 41px;">
				<span style="border-left: 5px solid #517EDB;font-size: 14px;"></span>
				<span style="font-size: 14px;font-weight: 800;margin-left: 10px;">step1:选择班级和年级</span>
			</Row >
			<Row style="padding:35px 40px 0px 45px;">
		        <Col span="24" style="text-align: left;">
		        	<span style="font-size: 14px;">年&nbsp;&nbsp;&nbsp;&nbsp;级：</span>
		            <RadioGroup v-model="grade" type="button" @on-change="changeselect">
		        		<Radio v-for="item in gradelist" :key="item.value" :label="item.value">{{item.label}}</Radio>
				        
				    </RadioGroup>
		        </Col>
		    </Row>
		    <Row style="padding:35px 40px 0px 45px;">
		        <Col span="24" style="text-align: left;">
		        	<span style="font-size: 14px;">班&nbsp;&nbsp;&nbsp;&nbsp;级：</span>
		        	<span style="padding-bottom:6px;margin-bottom:6px;">
				        <Checkbox
				            :value="checkAll"
				            @click.prevent.native="handleCheckAll"><span style="font-size: 14px;">全选</span></Checkbox>
				    </span>
		        	<CheckboxGroup  v-model="classselect"   @on-change="classchange">
		        		<Checkbox  v-for="item in classlist" :key="item.value" :label="item.value">{{item.label}}班</Checkbox>
				    </CheckboxGroup>
				   
		        </Col>
		    </Row>
		    <hr style="margin:40px 0px 0px 105px;width: 100%;background-color: rgba(240,240,240,1);border: none;height: 1px;" />
		    <Row style="text-align: left;margin-top: 41px;">
				<span style="border-left: 5px solid #517EDB;font-size: 14px;"></span>
				<span style="font-size: 14px;font-weight: 800;margin-left: 10px;">step2:导入基数成绩</span>
				<span @click="getdownload" style="cursor: pointer;font-size: 12px;color:#517edb;margin-left: 10px;"><i style="font-size: 15px;" class="iconfont alicon-down_light"></i>基数模板下载</span>
			</Row >
			
			<Row style="padding:30px 0px 0px 45px">
		       <div  style="float: left;text-align: right;margin-top:15px;font-size: 14px;width: 400px;">
			       	<div  style="text-align: left;width: 400px;">
				    	<span style="font-size: 14px;">学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;年：</span>
			            <Select placeholder="请选择学年" v-model="schoolYearStart" style="width:100px;text-align: center;" >
					        <Option v-for="item in schoolYearStartList" :value="item.value" :key="item.value">{{ item.label }}</Option>
					    </Select>
					    <!--<span style="font-size: 14px;margin-left: 29px;">考试类型：</span>
			            <Select placeholder="考试类型" v-model="examType" style="width:100px;text-align: center;" >
					        <Option v-for="item in examTypeList" :value="item.value" :key="item.value">{{ item.label }}</Option>
					    </Select>-->
				    </div>
				    <div style="margin-top:20px;">
				    	<div style="font-size: 14px;width: 71px;float: left;">基数名称：</div>
						<Input v-model="inputname" placeholder="请输入名称" style="width:314px;float: left;">
					        <!--<span slot="prepend">http://</span>-->
					    </Input>
				    </div>
		       		<div style="padding-top: 10px;">
		       			<Upload
					        multiple
					        ref="upload"
					        :before-upload="handleUpload"
					        :on-success="uploadSuccess"
					        name="file"
					        type="drag"
					        :show-upload-list="false"
					        :headers="headers"
					        :data="senddata"
					        :action="actionUrl">
					        <div style="padding: 20px 0;">
					            <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
					            <p>点击上传基数考试文档或拖拽到此处</p>
					        </div>
					    </Upload>
		       		</div>
		       		<div  style="text-align: left;margin-top:15px;margin-left:60px;font-size: 14px;">
					    <div v-for="(item, index) in file">文件: {{ item.name }} 
					        <Button @click="delectFile(item.keyID)" type="error" size="small" shape="circle" icon="close-round"></Button>
					        <Button style="margin-left:30px;"  v-if="index === 0" type="primary" @click="upload" >上传</Button>
					    </div>
					</div>
					<div  style="text-align: left;">
				    	<span style="font-size: 14px;">上传列表：</span>
			            <Select placeholder="请选择基数成绩" v-model="midBaseSelect" style="width:314px;text-align: center;" >
					        <Option v-for="item in midBase" :value="item.value" :key="item.value">{{ item.label }}</Option>
					    </Select>
					    <!--<span style="font-size: 14px;margin-left: 29px;">考试类型：</span>
			            <Select placeholder="考试类型" v-model="examType" style="width:100px;text-align: center;" >
					        <Option v-for="item in examTypeList" :value="item.value" :key="item.value">{{ item.label }}</Option>
					    </Select>-->
				    </div>
		       </div>
		       
		        
		        
		    </Row>
		    
		    <hr style="margin:20px 0px 0px 105px;width: 100%;background-color: rgba(240,240,240,1);border: none;height: 1px;" />
		    
		    
		    
		    <Row style="text-align: left;margin-top: 41px;">
				<span style="border-left: 5px solid #517EDB;font-size: 14px;"></span>
				<span style="font-size: 14px;font-weight: 800;margin-left: 10px;">step3:导入本次成绩</span>
				<span @click="getdownload1" style="cursor: pointer;font-size: 12px;color:#517edb;margin-left: 10px;"><i style="font-size: 15px;" class="iconfont alicon-down_light"></i>本次模板下载</span>
			</Row >
		    <Row  style="padding:35px 40px 0px 45px">
			    <div  style="text-align: left;width: 400px;">
			    	<span style="font-size: 14px;">学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;年：</span>
		            <Select placeholder="请选择学年" v-model="thisTime_schoolYearStart" style="width:100px;text-align: center;" >
				        <Option v-for="item in thisTime_schoolYearStartList" :value="item.value" :key="item.value">{{ item.label }}</Option>
				    </Select>
			    </div>
			</Row>
		    <Row style="padding:20px 40px 0px 45px">
		        <div  style="text-align: left;width: 400px;" >
		        	<div style="font-size: 14px;width: 71px;float: left;">本次名称：</div>
					<Input v-model="inputname3" placeholder="请输入名称" style="width:314px;">
				        <!--<span slot="prepend">http://</span>-->
				    </Input>
		        </div>
		    </Row>
		    <Row style="padding:0px 40px 0px 45px">
		       <Col span="8" style="text-align: right;margin-top:-20px;font-size: 14px;">
		        	<Upload
				        multiple
				        ref="upload3"
				        :before-upload="handleUpload3"
				        :on-success="uploadSuccess3"
				        name="file"
				        type="drag"
				        :show-upload-list="false"
				        :headers="headers"
				        :data="senddata3"
				        :action="actionUrl3">
				        <div style="padding: 20px 0;">
				            <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
				            <p>点击或者拖拽文件到此处</p>
				        </div>
				    </Upload>
		       </Col>
		    </Row>
		    <Row style="padding:5px 40px 0px 45px">
		       <Col span="12" style="text-align: left;margin-top:15px;margin-left:60px;font-size: 14px;">
				    <div v-for="(item, index) in file3">文件: {{ item.name }} 
				        <Button @click="delectFile3(item.keyID)" type="error" size="small" shape="circle" icon="close-round"></Button>
				        <Button style="margin-left:30px;"  v-if="index === 0" type="primary" @click="upload3" >上传</Button>
				    </div>
				</Col>
		    </Row>
		    <Row style="padding:5px 40px 0px 45px">
			    <div  style="text-align: left;">
			    	<span style="font-size: 14px;">上传列表：</span>
		            <Select placeholder="请选择本次成绩" v-model="midThisSelect" style="width:314px;text-align: center;" >
				        <Option v-for="item in midThis" :value="item.value" :key="item.value">{{ item.label }}</Option>
				    </Select>
				    <!--<span style="font-size: 14px;margin-left: 29px;">考试类型：</span>
		            <Select placeholder="考试类型" v-model="examType" style="width:100px;text-align: center;" >
				        <Option v-for="item in examTypeList" :value="item.value" :key="item.value">{{ item.label }}</Option>
				    </Select>-->
			    </div>
		    </Row>
		    <hr style="margin:20px 0px 0px 105px;width: 100%;background-color: rgba(240,240,240,1);border: none;height: 1px;" />
		    <Row style="text-align: left;margin-top: 41px;">
				<span style="border-left: 5px solid #517EDB;font-size: 14px;"></span>
				<span style="font-size: 14px;font-weight: 800;margin-left: 10px;">step4:评价计算</span>
			</Row >
		    <div style="text-align: left;margin-top: 20px;">
		    	<span style="font-size: 14px;margin-left: 45px;">评价名称：</span>
		    	<Input v-model="performName" placeholder="请输入评价名字" style="width: 200px" />
		    </div>
		    <div style="text-align: left;">
		    	<Button @click="calculation" style="margin:40px 0px 20px 118px;width: 180px;height: 50px;" size="large" type="primary">评价计算</Button>
		    
		    </div>
		    
		</div>
	</div>
</template>

<script>
	import api from "@/components/js/Apidomain.js"
	import { getsessionstorage } from '@/components/js/Localstorage'
	var timeId;
	export default{
		data(){
			return{
				percent:0,
				//iview的checkbox处理示例
//				indeterminate: true,
                checkAll: false,
//				classselect: ['香蕉', '西瓜']
				
				
				grade:"",							//选择的年级
				classselect:[],				//选择班级的select
				schoolYearStart:"",					//学年
				thisTime_schoolYearStart:"",					//本次学年
				
				
				midBase: [],					//--基数考试列表
				midBaseSelect: "",					//--基数考试选择
				
			    midThis:[],						//高中本次导入的所有列表
			    midThisSelect:"",				//高中本次选择
			    
			    performName:"",					//评价计算名字
				
				//基数
				inputname:"",						//输入的名称
				file:[],
				uploadFile: [],
				actionUrl:"",
				headers: {
				    'Authorization' : ''
				},
				senddata:{
					gradeId:"",									//年级ID
					examName:"", 								//输入的名字
					isBase:1, 									//是否为基数考试（是为1，否为0）
					isThis:0,										//是否为本次考试（是为1，否为0）
					examType:3,						//考试类型
					schoolYearStart:"",					//学年开始
					schoolYearEnd:"",
				},
				
				
				
				
				
				//本次
				inputname3:"",						//输入的名称
				file3:[],
				uploadFile3: [],
				actionUrl3:"",
				senddata3:{
					gradeId:"",									//年级ID
					examName:"", 								//输入的名字
					isBase:0, 									//是否为基数考试（是为1，否为0）
					isThis:1,										//是否为本次考试（是为1，否为0）
					schoolYearStart:"",							//学年开始
					schoolYearEnd:"",
				},
				
				
				gradelist: [
//					{value: '2',label: '初一年级'},
//                  {value: '3',label: '初二年级'},
//                  {value: '4',label: '初三年级'},
//                  {value: '5',label: '高一年级'},
//                  {value: '6',label: '高二年级'},
//                  {value: '7',label: '高三年级'},  
                ],
                classlist: [
//					{value: '1',label: '01班'},
//					{value: '2',label: '02班'},
//                  {value: '3',label: '03班'}, 
//                  {value: '4',label: '04班'},
//					{value: '5',label: '05班'},
//                  {value: '6',label: '06班'}, 
                ],
                schoolYearStartList:[		//学年列表
//              	{value: '2015',label: '2015'},
//					{value: '2016',label: '2016'},
                ],	

                thisTime_schoolYearStartList:[		//学年列表
//              	{value: '2015',label: '2015'},
//					{value: '2016',label: '2016'},
                ],
			}
		},
		created(){
			this.getgradelist()
		
		},
		computed: {
            color () {
                let color = '#2db7f5';
                if (this.percent == 100) {
                    color = '#5cb85c';
                }
                return color;
            }
        },
		methods:{
			start () {
                if (this.percent >= 85) {
                    return;
                }else if(this.percent >= 0 && this.percent <= 70){
                	let self = this;
	                self.percent += 5
	                timeId = setTimeout(function(){self.start()},500)
                }else{
                	let self = this;
	                self.percent += 1
	                timeId = setTimeout(function(){self.start()},500)
                }
                
                
            },
            successEnd () {
                this.percent = 100;
                let self = this;
                clearTimeout(timeId);
                setTimeout(function(){self.percent = 0;},1000)
            },
            failEnd () {
            	clearTimeout(timeId);
                this.percent = 0;
            },
//			iview的checkbox处理示例
			handleCheckAll:function() {
                if (this.checkAll) {
                    this.checkAll = false;
                } else {
                    this.checkAll = !this.checkAll;
                }
//              this.indeterminate = false;

                if (this.checkAll) {
                	this.classselect = [];
					for(let i = 0;i<this.classlist.length;i++){
						this.classselect.push(this.classlist[i].value)
					}
//                  this.classselect = ['香蕉', '苹果', '西瓜'];
                } else {
                    this.classselect = [];
                }
            },
            //checkbox改变班级后执行函数
            classchange:function(data) {
                if (data.length === this.classlist.length) {
//                  this.indeterminate = false;
                    this.checkAll = true;
                } else if (data.length > 0) {
//                  this.indeterminate = true;
                    this.checkAll = false;
                } else {
//                  this.indeterminate = false;
                    this.checkAll = false;
                }
            },
            
			//改变年级触发的函数
			changeselect:function(value){
				
				this.midBaseSelect = "",					//--基数考试选择
			    this.midThisSelect = "",				//高中本次选择
				this.classselect = [];
				this.getclasslist();
				this.getschoolYearStartList()
				this.getthisTime_schoolYearStartList()
				this.getThreeBase()
			},
			//获取年级选择列表
			getgradelist:function(){
//         		this.gradelistshow = true;
           		var self = this;
            	let url = api.apidomain+'/tqes/web/tchGrade/selectGrade';
            	this.$http.post(url, {"type":"High"}).then(function(response) {
					if(response.data.success == true){
						
//						////console.log(response.data.data)
						self.gradelist = response.data.data
						if(self.gradelist.length != 0){
							self.grade = self.gradelist[0].value;
							self.changeselect()
						}
//						self.gradelistshow = false;
		            }else if(response.data.success == false){
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});	
//		            		self.gradelistshow = false;
		            	}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00093',
							duration: 10,
							closable: true
						});
//						self.gradelistshow = false;
					});
           	},
           	//获取班级级选择列表
           	getclasslist:function(){
//         		this.classlistshow = true;
           		var self = this;
            	let url = api.apidomain+'/tqes/web/tchStudent/getTchClasses';
            	this.$http.post(url, {gradeId:this.grade}).then(function(response) {
					if(response.data.success == true){
						
//						////console.log(response.data.data)
						self.classlist = response.data.data
						//第一次页面进来加载第一项
//						if(self.classlist.length != 0){
//							self.classselect = self.classlist[0].value;
//							self.getstudentlist();;
//						}
						
//						self.classlistshow = false;
		            }else if(response.data.success == false){
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});	
//		            		self.classlistshow = false;
		            	}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00094',
							duration: 10,
							closable: true
						});
//						self.classlistshow = false;
					});
           	},
           	//获取学年和考试列表(基数)
			getschoolYearStartList:function(){
//         		this.gradelistshow = true;
           		var self = this;
            	let url = api.apidomain+'/tqes/web/squaAnalysis/getQuerySchoolYearSelect';
            	this.$http.post(url, {gradeId:this.grade}).then(function(response) {
					if(response.data.success == true){
//						////console.log(response.data.data)
						self.schoolYearStartList = response.data.data
		            }else if(response.data.success == false){
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
//		            		self.gradelistshow = false;
		            	}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00095',
							duration: 10,
							closable: true
						});
//						self.gradelistshow = false;
					});
           	},
           	//获取上传的基数考试（三个上传框）      初中基数考试查看
           	getThreeBase:function(){
//         		this.gradelistshow = true;
           		var self = this;
            	let url = api.apidomain+'/tqes/web/quaPerformance/getBasePerformance';
            	this.$http.post(url, {"gradeId": this.grade}).then(function(response) {
					if(response.data.success == true){
//						////console.log(response.data.data)
						
						self.midBase = response.data.data.highBase
					    self.midThis = response.data.data.midThis
					    
		            }else if(response.data.success == false){
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
//		            		self.gradelistshow = false;
		            	}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00096',
							duration: 10,
							closable: true
						});
//						self.gradelistshow = false;
					});
           	},
           	//获取学年和考试列表(本次)
           	getthisTime_schoolYearStartList:function(){
//         		this.gradelistshow = true;
           		var self = this;
            	let url = api.apidomain+'/tqes/web/squaAnalysis/getQuerySchoolYearSelect';
            	this.$http.post(url, {gradeId: this.grade}).then(function(response) {
					if(response.data.success == true){
//						////console.log(response.data.data)
						self.thisTime_schoolYearStartList = response.data.data
		            }else if(response.data.success == false){
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
//		            		self.gradelistshow = false;
		            	}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00097',
							duration: 10,
							closable: true
						});
//						self.gradelistshow = false;
					});
           	},
           	//下载基数模板
       		getdownload:function(){
	       		if(this.grade == "" ){
					this.$Message.error('请先选择年级在下载');
					return;
				}
	       		var senddata = {
	       			gradeId:this.grade, 
					isBase:1,
					isThis:0,
	       		}
//				this.loading = true;
				var self = this;
	        	let url = api.apidomain+'/tqes/web/tchExam/exportExamStudentListExcel';
	        	this.$http.post(url,senddata).then(function(response) {
					if(response.data.success == true){
	//						////console.log(response.data.data)
						window.location.href = response.data.data;
//						self.loading = false;
	            }else if(response.data.success == false){
//	            		self.loading = false;
	            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
	            	}
	            	
				})
				.catch(function(error) {
//					self.loading = false;
					self.$Message.error({
							content: '系统发生错误：错误码00098',
							duration: 10,
							closable: true
						});
				});
			},
			//下载本次模板
			getdownload1:function(){
	       		if(this.grade == "" ){
					this.$Message.error('请先选择年级在下载');
					return;
				}
	       		var senddata = {
	       			gradeId:this.grade, 
					isBase:0,
					isThis:1,
	       		}
//				this.loading = true;
				var self = this;
	        	let url = api.apidomain+'/tqes/web/tchExam/exportExamStudentListExcel';
	        	this.$http.post(url,senddata).then(function(response) {
					if(response.data.success == true){
	//						////console.log(response.data.data)
						window.location.href = response.data.data;
//						self.loading = false;
	            }else if(response.data.success == false){
//	            		self.loading = false;
	            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
	            	}
	            	
				})
				.catch(function(error) {
//					self.loading = false;
					self.$Message.error({
							content: '系统发生错误：错误码00099',
							duration: 10,
							closable: true
						});
				});
			},
           	//评价计算
			calculation:function(){
				
           		//
           		if(this.checkAll == true){
           			var senddata = {
						"performName":this.performName, 		//评价名称
						"gradeId":this.grade,			//年级ID
						"baseExamId":this.midBaseSelect,		//基数考试ID
//						"firstOverExamId":this.midFirstBaseSelect,	//初一下学期期末考试ID
//						"secondOverExamId":this.midSecondBaseSelect,	//初二下学期期末考试ID
						"thisExamId":this.midThisSelect,		//本次考试ID
					}
           			var url = api.apidomain+'/tqes/web/quaPerformance/algorithm';
           		}else{
           			var senddata = {
           				"performName":this.performName,
						"gradeId":this.grade,
						"baseExamId":this.midBaseSelect,		//基数考试ID
//						"firstOverExamId":this.midFirstBaseSelect,	//初一下学期期末考试ID
//						"secondOverExamId":this.midSecondBaseSelect,	//初二下学期期末考试ID
						"thisExamId":this.midThisSelect,		//本次考试ID
						"classesIds":this.classselect
					}
           			var url = api.apidomain+'/tqes/web/quaPerformance/algorithmByClasses';
           		}
           		this.start();
				var self = this;
            	this.$http.post(url,senddata).then(function(response) {
					if(response.data.success == true){
						self.successEnd();
						self.$Message.success({
		                    content: '保存成功',
		                    duration: 10,
		                    closable: true
               			})
						
		            }else if(response.data.success == false){
		            		self.failEnd();
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});
		            		
		            	}
					})
					.catch(function(error) {
						self.failEnd();
						self.$Message.error({
							content: '系统发生错误：错误码000100',
							duration: 10,
							closable: true
						});
						
					});
			},
			
			
			//基数
			handleUpload (file) { // 上传文件前的事件钩子
				let filename = file.name;
				let cutfilename = filename.slice(0,filename.lastIndexOf('.'))
				this.inputname = cutfilename
				
				this.actionUrl = api.apidomain + '/tqes/web/tchExam/upLoadExamExcel';
				let token = getsessionstorage("authorization");
				this.headers.Authorization = token;
				this.senddata.gradeId = this.grade;
				this.senddata.examName = this.inputname;
//				this.senddata.examType = this.examType;					//考试类型
				this.senddata.schoolYearStart = this.schoolYearStart;	
				this.senddata.schoolYearEnd = parseInt(this.schoolYearStart)+1;						//学年开始
//				//console.log(this.senddata)
				
				
			    // 选择文件后 这里判断文件类型 保存文件 自定义一个keyid 值 方便后面删除操作
			    let keyID = Math.random().toString().substr(2);
			    file['keyID'] = keyID;
			    // 保存文件到总展示文件数据里
			    this.file.push(file);
			    // 保存文件到需要上传的文件数组里
			    this.uploadFile.push(file)
			    // 返回 falsa 停止自动上传 我们需要手动上传
			    return false;
			},
			delectFile (keyID) { // 删除文件
//				//console.log(keyID);
			    // 删除总展示文件里的当前文件
			    this.file = this.file.filter(item => {
                    return item.keyID != keyID
                })
                this.uploadFile = this.uploadFile.filter(item => {
                    return item.keyID != keyID
                })
			},
			upload () { // 上传文件
				this.senddata.examName = this.inputname;
//				this.loadingshow = true;
			    for (let i = 0; i < this.uploadFile.length; i++) {
			        let item = this.file[i]
			        this.$refs.upload.post(item);
			    }
			},
			uploadSuccess (res, file,fileList) { // 文件上传回调 上传成功后删除待上传文件
				if(res.success == true){
//						this.loadingshow = false;
						this.$Message.success({
		                    content: '上传成功',
		                    duration: 10,
		                    closable: true
               			})
						this.file = [];
						this.uploadFile = [];
						this.changeselect()
	            }
				if(res.success == false){
//						this.loadingshow = false;
						this.$Message.error({
								content: res.msg,
								duration: 10,
								closable: true
							});	
						this.file = [];
						this.uploadFile = [];
	            }
				
			},
			
			
//			//初一下学期期末
//			handleUpload1 (file) { // 上传文件前的事件钩子
//				
//				let filename = file.name;
//				let cutfilename = filename.slice(0,filename.lastIndexOf('.'))
//				this.inputname1 = cutfilename
//				
//				this.actionUrl1 = api.apidomain + '/tqes/web/tchExam/upLoadExamExcel';
//				let token = getsessionstorage("authorization");
//				this.headers.Authorization = token;
//				this.senddata1.gradeId = this.grade;
//				this.senddata1.examName = this.inputname1;
//				this.senddata1.schoolYearStart = this.schoolYearStart;
//				this.senddata1.schoolYearEnd = parseInt(this.schoolYearStart)+1;
////				//console.log(this.senddata1)
//				
//				
//			    // 选择文件后 这里判断文件类型 保存文件 自定义一个keyid 值 方便后面删除操作
//			    let keyID = Math.random().toString().substr(1);
//			    file['keyID'] = keyID;
//			    // 保存文件到总展示文件数据里
//			    this.file1.push(file);
//			    // 保存文件到需要上传的文件数组里
//			    this.uploadFile1.push(file)
//			    // 返回 falsa 停止自动上传 我们需要手动上传
//			    return false;
//			},
//			delectFile1 (keyID) { // 删除文件
////				//console.log(keyID);
//			    // 删除总展示文件里的当前文件
//			    this.file1 = this.file1.filter(item => {
//                  return item.keyID != keyID
//              })
//              this.uploadFile1 = this.uploadFile1.filter(item => {
//                  return item.keyID != keyID
//              })
//			},
//			upload1 () { // 上传文件
////				this.loadingshow = true;
//			    for (let i = 0; i < this.uploadFile1.length; i++) {
//			        let item = this.file1[i]
//			        this.$refs.upload1.post(item);
//			    }
//			},
//			uploadSuccess1 (res, file,fileList) { // 文件上传回调 上传成功后删除待上传文件
//				if(res.success == true){
////						this.loadingshow = false;
//						this.$Message.success('上传成功');
//						this.file1 = [];
//						this.uploadFile1 = [];
//						this.changeselect()
//	            }
//				if(res.success == false){
////						this.loadingshow = false;
//						this.$Message.error(res.msg);
//						this.file1 = [];
//						this.uploadFile1 = [];
//	            }
//				
//			},
//			
//			
//			handleUpload2 (file) { // 上传文件前的事件钩子
//				
//				let filename = file.name;
//				let cutfilename = filename.slice(0,filename.lastIndexOf('.'))
//				this.inputname2 = cutfilename
//				
//				this.actionUrl2 = api.apidomain + '/tqes/web/tchExam/upLoadExamExcel';
//				let token = getsessionstorage("authorization");
//				this.headers.Authorization = token;
//				this.senddata2.gradeId = this.grade;
//				this.senddata2.examName = this.inputname2;
//				this.senddata2.schoolYearStart = this.schoolYearStart;
//				this.senddata2.schoolYearEnd = parseInt(this.schoolYearStart)+1;
////				//console.log(this.senddata2)
//				
//				
//			    // 选择文件后 这里判断文件类型 保存文件 自定义一个keyid 值 方便后面删除操作
//			    let keyID = Math.random().toString().substr(2);
//			    file['keyID'] = keyID;
//			    // 保存文件到总展示文件数据里
//			    this.file2.push(file);
//			    // 保存文件到需要上传的文件数组里
//			    this.uploadFile2.push(file)
//			    // 返回 falsa 停止自动上传 我们需要手动上传
//			    return false;
//			},
//			delectFile2 (keyID) { // 删除文件
////				//console.log(keyID);
//			    // 删除总展示文件里的当前文件
//			    this.file2 = this.file2.filter(item => {
//                  return item.keyID != keyID
//              })
//              this.uploadFile2 = this.uploadFile2.filter(item => {
//                  return item.keyID != keyID
//              })
//			},
//			upload2 () { // 上传文件
////				this.loadingshow = true;
//			    for (let i = 0; i < this.uploadFile2.length; i++) {
//			        let item = this.file2[i]
//			        this.$refs.upload2.post(item);
//			    }
//			},
//			uploadSuccess2 (res, file,fileList) { // 文件上传回调 上传成功后删除待上传文件
//				if(res.success == true){
////						this.loadingshow = false;
//						this.$Message.success('上传成功');
//						this.file2 = [];
//						this.uploadFile2 = [];
//						this.changeselect()
//	            }
//				if(res.success == false){
////						this.loadingshow = false;
//						this.$Message.error(res.msg);
//						this.file2 = [];
//						this.uploadFile2 = [];
//	            }
//				
//			},
			
			//本次
			handleUpload3 (file) { // 上传文件前的事件钩子
				
				let filename = file.name;
				let cutfilename = filename.slice(0,filename.lastIndexOf('.'))
				this.inputname3 = cutfilename
				
				this.actionUrl3 = api.apidomain + '/tqes/web/tchExam/upLoadExamExcel';
				let token = getsessionstorage("authorization");
				this.headers.Authorization = token;
				this.senddata3.gradeId = this.grade;
				this.senddata3.examName = this.inputname3;
				this.senddata3.schoolYearStart = this.thisTime_schoolYearStart;
				this.senddata3.schoolYearEnd = parseInt(this.thisTime_schoolYearStart)+1;
//				//console.log(this.senddata3)
				
				
			    // 选择文件后 这里判断文件类型 保存文件 自定义一个keyid 值 方便后面删除操作
			    let keyID = Math.random().toString().substr(2);
			    file['keyID'] = keyID;
			    // 保存文件到总展示文件数据里
			    this.file3.push(file);
			    // 保存文件到需要上传的文件数组里
			    this.uploadFile3.push(file)
			    // 返回 falsa 停止自动上传 我们需要手动上传
			    return false;
			},
			delectFile3 (keyID) { // 删除文件
//				//console.log(keyID);
			    // 删除总展示文件里的当前文件
			    this.file3 = this.file3.filter(item => {
                    return item.keyID != keyID
                })
                this.uploadFile3 = this.uploadFile3.filter(item => {
                    return item.keyID != keyID
                })
			},
			upload3 () { // 上传文件
//				this.loadingshow = true;
			    for (let i = 0; i < this.uploadFile3.length; i++) {
			        let item = this.file3[i]
			        this.$refs.upload3.post(item);
			    }
			},
			uploadSuccess3 (res, file,fileList) { // 文件上传回调 上传成功后删除待上传文件
				if(res.success == true){
//						this.loadingshow = false;
						this.$Message.success({
		                    content: '上传成功',
		                    duration: 10,
		                    closable: true
               			})
						this.file3 = [];
						this.uploadFile3 = [];
						this.changeselect()
	            }
				if(res.success == false){
//						this.loadingshow = false;
						this.$Message.error({
								content: res.msg,
								duration: 10,
								closable: true
							});	
						this.file3 = [];
						this.uploadFile3 = [];
	            }
				
			},
		},
		watch:{

		}
	}
</script>

<style lang="css" scoped>
	.introductioncalculation >>> .ivu-upload .ivu-upload-drag{
		margin-top: 40px;
	    width: 315px;
    	margin-left: 71px
	}
	.introductioncalculation >>> .ivu-checkbox-group{
		display: inline-block;
	}
	.introductioncalculation >>> .ivu-checkbox-group-item{
		display: inline-block;
    	font-size: 14px;
	}
	.introductioncalculation >>> .ivu-tabs-content .ivu-tabs-content-animated{
		transform: none !important
	}
</style>